package my.soft.aiteacher.student.controller;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import my.soft.aiteacher.student.pojo.NoteDo;
import my.soft.aiteacher.student.pojo.NoteVo;
import my.soft.aiteacher.student.service.ITbNoteService;
import my.soft.aiteacher.utils.R;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 学生笔记表 前端控制器
 * </p>
 *
 * @author GMCX
 * @since 2025-06-11
 */
@RestController
@Tag(name = "学生-笔记管理", description = "学生-笔记管理")
@RequestMapping("/student/note")
public class TbNoteController {
    @Resource
    private ITbNoteService tbNoteService;

    @Operation(summary = "上传学生笔记")
    @RequestMapping(value = "/uploadNote",method = RequestMethod.POST)
    public R uploadNote(@RequestBody NoteVo noteVo) {
        tbNoteService.uploadNote(noteVo);
        return R.success("ok");
    }

    @Operation(summary = "查询学生笔记列表")
    @RequestMapping(value = "/queryNoteList/{userId}",method = RequestMethod.GET)
    public R queryNoteList(@PathVariable String userId) {
        List<NoteVo> noteVoList  = tbNoteService.queryNoteList(userId);
        return R.success(noteVoList);
    }
    @Operation(summary = "更新学生笔记")
    @RequestMapping(value = "/updateNote",method = RequestMethod.POST)
    public R updateNote(@RequestBody NoteVo noteVo) {
        tbNoteService.updateNote(noteVo);
        return R.success("ok");
    }
    @Operation(summary = "删除学生笔记")
    @RequestMapping(value = "/deleteNote/{id}",method = RequestMethod.POST)
    public R deleteNote(@PathVariable String id) {
        tbNoteService.removeById(id);
        return R.success("ok");
    }


}
